1 using UnityEngine;
2 using
System.Collections;
3
4 namespace
GamePlay
5 {
6
7     
public class CameraController : MonoBehaviour
8     {
9
10         
public Animals animals;
11
12         
private GameObject animalPlayer;
13
14         
public void Start()
15         {
16             
//animalPlayer = animals.getAnimal(0);
17         }
18
19         
void Update()
20         {
21             
if(animalPlayer == null){
22                 animalPlayer = animals.getAnimal(
0);
23                 
return;
24             }
25             
26             
if (animalPlayer.transform.localPosition.x >= -1)
27                 transform.localPosition =
new Vector3(animalPlayer.transform.localPosition.x + 1, 0, transform.localPosition.z);
28         }
29     }
30 }


animalPlayer = animals.getAnimal(0);




Trò chơi đua xe động vật trong UNITY Engine 114.787 lượt xem

Gõ tìm kiếm nhanh...